import java.util.Scanner;
 
/*
 * 理性算数RationalArithmetic
 */
 
public class RationalArithmetic {
    public static void simplify(long a, long b) {
        long x = gcd(a, b);
        a /= x;
        b /= x;
        if (b < 0) {
            a *= -1;
            b *= -1;
        }
        if (a < 0) {
            if (-a % b == 0) {
                System.out.print("(" + a / b + ")");
            } else if (-a < b) {
                System.out.print("("+a + "/" + b+")");
            } else {
                System.out.print("(" + a / b + " " + (-a + (b * (a / b))) + "/" + b + ")");
            }
        } else {
            if (a % b == 0) {
                System.out.print(a / b);
            } else if (a < b) {
                System.out.print(a + "/" + b);
            } else {
                System.out.print(a / b + " " + (a - (b * (a / b))) + "/" + b );
            }
        }
    }
    public static long  gcd(long a, long b) { //辗转相除法求最大公约数
        if (b == 0) {
            return a;
        }
        long r = a % b;
        return gcd(b, r);
    }
    public static void add(long a, long b, long c, long d) {
        simplify(a, b);
        System.out.print(" + ");
        simplify(c, d);
        System.out.print(" = ");
        simplify(a * d + b * c, b * d);
    }
    public static void minus(long a, long b, long c, long d) {
        simplify(a, b);
        System.out.print(" - ");
        simplify(c, d);
        System.out.print(" = ");
        simplify(a * d - b * c, b * d);
    }
    public static void multiply(long a, long b, long c, long d) {
        simplify(a, b);
        System.out.print(" * ");
        simplify(c, d);
        System.out.print(" = ");
        simplify(a * c, b * d);
    }
    public static void division(long a, long b, long c, long d) {
        long m = a * d;
        long n = b * c;
        simplify(a, b);
        System.out.print(" / ");
        simplify(c, d);
        System.out.print(" = ");
        if (c == 0) {
            System.out.print("Inf");
        } else {
            if (n < 0) {
                m = m * -1; //把负号调整到分子上
                n = n * -1;
            }
            simplify(m, n);
        }
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String s = sc.nextLine();
            String[] split = s.split(" ");
            String[] s1 = split[0].split("/");
            String[] s2 = split[1].split("/");
            long a = Long.parseLong(s1[0]);
            long b = Long.parseLong(s1[1]);
            long c = Long.parseLong(s2[0]);
            long d = Long.parseLong(s2[1]);
            add(a, b, c, d);
            System.out.println();
            minus(a, b, c, d);
            System.out.println();
            multiply(a, b, c, d);
            System.out.println();
            division(a, b, c, d);
        }
    }
}